package com.hmf.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@Import(WebConfig.class)
@Configuration
@ComponentScan({"com.hmf.contrller","com.hmf.intercept"})
@EnableWebMvc
public class SpringMvcConfig {
    public SpringMvcConfig(){
        System.out.println("----------SpringMvcConfig-------------");
    }
    @Bean  //前后端分离不需要视图解析器
    public ViewResolver viewResolver() {
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setPrefix("/WEB-INF/views/");
        viewResolver.setSuffix(".jsp");
        return viewResolver;
    }
}